import React, { memo, useEffect } from "react"
import { useLocation, useRoutes } from "react-router-dom"
import routes from "./router"
import "antd/dist/antd.css" // 引入 antd 的 CSS

import AppHeader from "./components/app-header"
import AppFooter from "./components/app-footer"
import useScrollTop from "./hook/useScrollTop"

const App = memo(() => {
    // 切换页面后滚动到顶部
    useScrollTop()
    return (
        <div className="app">
            <AppHeader />
            <div className="page">{useRoutes(routes)}</div>
            <AppFooter />
        </div>
    )
})

export default App
